#{extends 'main.html' /} #{set title:'Assign Owner' /}
<!-- @author Ebaa

this page displays all members of the community list with a button beside each to assign as an owner of the community list -->
<br></br>
#{ifnot membersList}
<p>You have No Community List Members to choose an owner</p>
#{/ifnot} 
#{else}
<B>Members List to assign an owner from :</B>
#{list items:membersList, as:'mList'}
<br></br>
<li>
<span style="word-spacing:2.1em;">
	${mList.name} points:${mList.points} </span><script type="text/javascript"> 
		function confirmation() {
			var answer = confirm("Are you sure you want to assign this member as an owner to this community list?")
			if (answer) {
				alert("This member is now the owner of the community list")
				return true
			} else {
				return false
			}
		}
	</script>
	#{if !(mList.ownerCommunityLists.contains(models.CommunityList.findById(commListId)))}
	<form action="@{CommunityLists.chooseOwner()}" method="GET">
		<button name="userId" type="submit" value="${mList.id}"
			onClick="return confirmation()">Assign this member as an
			owner</button>
		<input type="hidden" name="commListId" value="${commListId}" />
	</form> #{/if} #{else}
	<p>Owner of this Community List</p> #{/else}
</li>
#{/list}
#{/else}
